package com.example.peibei.ui.adapter;

import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.dingtao.common.bean.Search;
import com.dingtao.common.bean.SearchResult;
import com.example.peibei.R;
import com.example.peibei.ui.utils.LevelImage;

import java.util.List;

public class RecommendAdapter extends BaseQuickAdapter<SearchResult.DataDTO.ResultDTO, BaseViewHolder> {
    public RecommendAdapter(@Nullable List<SearchResult.DataDTO.ResultDTO> data) {
        super(R.layout.item_search_list, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, SearchResult.DataDTO.ResultDTO item) {
        helper.setText(R.id.tv_name, item.getNickName()).setText(R.id.tv_id,item.getAutoId()+"").setText(R.id.tv_follows,item.getFollower()+"");
        ImageView iv_level = helper.getView(R.id.iv_level);//会员等级
        LevelImage.setLevelImage(item.getServiceLevel(),iv_level);
        LinearLayout ll_no_follow = helper.getView(R.id.ll_no_follow);
        LinearLayout ll_followed = helper.getView(R.id.ll_followed);
        if (item.isFollow()) {
            ll_no_follow.setVisibility(View.VISIBLE);
            ll_followed.setVisibility(View.GONE);
        } else {
            ll_no_follow.setVisibility(View.GONE);
            ll_followed.setVisibility(View.VISIBLE);
        }
    }
}
